package com.testcolision;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Rectangle;

public class OnscreenControlListener  {

	Rectangle controlButtonRect;
	Rectangle followButtonRect;
	Rectangle upButtonRect;
	Rectangle leftButtonRect;
	Rectangle rightButtonRect;
	Rectangle dpadRect = new Rectangle(0, 0, 128, 128);
	float screenWidth, screenHeight;

	public OnscreenControlListener() {
		screenHeight = Gdx.graphics.getHeight();
		screenWidth = Gdx.graphics.getWidth();
		
		controlButtonRect = new Rectangle(screenWidth - 64, 0, 64, 64);
		upButtonRect = new Rectangle(screenWidth - 64, screenHeight - 64, 64, 64);
		leftButtonRect = new Rectangle(0, screenHeight - 64, 64, 64);
		rightButtonRect = new Rectangle(64, screenHeight - 64, 64, 64);
		followButtonRect = new Rectangle(screenWidth - 64,screenHeight - 138, 64, 64);
	}

	public boolean controlButton(int x, int y) {
		return  controlButtonRect.contains(x, y);
	}

	public boolean upButton(int x, int y) {
		return  upButtonRect.contains(x, y);
	}

	public boolean leftButton(int x, int y) {
		return leftButtonRect.contains(x, y);
		
	}
	public boolean rightButton(int x, int y) {
		return rightButtonRect.contains(x, y);
	}
	public boolean followButton(int x, int y) {
		return followButtonRect.contains(x, y);
	}


 
}
